<?php include $this->admin_tpl('meta');?>
<title>编辑模型 - YzmCMS内容管理系统</title>
</head>
<body>
<article class="page-container">
<div class="formdoby_normal"> 
	<form method="post" onsubmit="return dosub(this)">
		<ul>
			 <li><label><span class="c-red">*</span>模型名称：</label><input type="text" class="input" name="name" value="<?php echo $data['name'];?>"></li>
			 <li><label><span class="c-red">*</span>模型表名：</label><input type="text" class="input" value="<?php echo $data['tablename'];?>" name="tablename" disabled="disabled"></li>	
			 <li><label>模型简介：</label><span class="span_input"><textarea name="description" class="textarea" style="width:70%"><?php echo $data['description'];?></textarea></span></li>	
			 <li><label>默认模型：</label>
			 <span class="span_input yzm-explain-box">
			 	<label class="label_radio"><input name="isdefault" type="radio" value="1" <?php echo $data['isdefault']==1 ? ' checked="checked" ' : '';?>> 是</label>
			 	<label class="label_radio"><input name="isdefault" type="radio" value="0" <?php echo $data['isdefault']==0 ? ' checked="checked" ' : '';?>> 否</label>
			 	<span class="yzm-explain">设为默认模型后，内容管理默认展示该模型下的数据</span>
			 </span>
			 </li>				 
			<li>
				<input type="hidden" name="dosubmit" value="1"><input type="hidden" name="modelid" value="<?php echo $data['modelid'];?>">
				<input class="dosubmit w_120 btn-primary radius" type="submit" value="提交">
			 	<input class="btn w_120 btn-default radius" type="button" value="取消" onclick="yzmcms_close()">
			</li>
		</ul>
	</form>
</div>
</article>
<?php include $this->admin_tpl('footer');?>

<script type="text/javascript">
	function dosub(obj){
		 var reg = /^[a-zA-Z]{1}([a-zA-Z0-9]|[_]){0,19}$/;	
		 if(obj.name.value==''){
			 layer.msg('模型名称不能为空！');
			 return false;
		 }
        $.ajax({
            type: 'POST',
            url: '<?php echo U('edit');?>', 
            data: $(obj).serialize(),
		    dataType: "json", 
            success: function (msg) {
				if(msg.status == 1){
					layer.msg(msg.message, {icon:1, time:800}, function(){
						parent.location.reload();
					});
			    }else{
					layer.msg(msg.message, {icon:2});
				}
            }
        })		 
		return false;			 
	}
</script> 

</body>
</html>